home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
-
- <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
- <window id="stumble_discovery_dialog" title="Discovery - StumbleUpon"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- onload="init();"
- style="background-color:white;">
-
- <script type="application/x-javascript">
- <![CDATA[
-
- var detail;
- var browser;
-
- function init()
- {
- detail = window.arguments[0];
- // Old, Straightforward technique is commented out for now.
- // We use XMLHttpRequest instead to work around a NoScript problem. NoScript by default will
- // block cross-domain POST requests, even if they are from a Chrome URL. We are hoping Giorgio
- // will fix this, but until then we need to use the XmlHttpRequest workaround.
- browser = document.getElementById("browser");
- var url = opener.su_base_url + detail.uri_suffix;
-
- browser.webNavigation.loadURI(
- url,
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE,
- opener.su_get_nsiuri(opener.getBrowser().contentDocument.referrer),
- opener.su_get_mime_input_stream(detail.postdata, "application/x-www-form-urlencoded"),
- null); // headers
- browser.addEventListener("click", handle_content_click, false);
-
- }
-
- function handle_content_click(event)
- {
- if (event.originalTarget.hasAttribute("ondblclick"))
- ondblclick = event.originalTarget.getAttribute("ondblclick");
-
- var current_page = opener.su_get_browser_url(event.target.ownerDocument, true);
-
- if(ondblclick == "whitelist_stumbleupon_with_noscript")
- {
- var tld = opener.su_get_tld(current_page);
- if (tld == opener.su_servername)
- {
- opener.su_update_noscript_whitelists();
- var ps = opener.su_get_service(
- "@mozilla.org/embedcomp/prompt-service;1",
- "nsIPromptService");
-
- ps.alert(window, "StumbleUpon", "NoScript configuration updated. Please try the operation again.");
- window.close();
- }
- }
-
- return true;
- }
-
- function handle_submit_command()
- {
- try {
- var el = browser.contentDocument.getElementById("tagtext");
- if (el)
- detail.tagtext = decodeURIComponent(el.getAttribute("value"));
- } catch (e) {}
- detail.submitted = true;
- window.close();
- }
-
- function handle_cancel_command()
- {
- window.close();
- }
-
- document.addEventListener("RATING_CANCELLED", handle_cancel_command, false, true);
- document.addEventListener("RATING_SUBMITTED", handle_submit_command, false, true);
-
- ]]>
- </script>
- <browser id="browser"
- flex="1"/>
- </window>
-